﻿using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Media;

namespace Main.lib.util
{

    /*
     * Cache
     * 
     * @brief   Linker to all the resources
     * @version 2011.11.14
     * 
     * @author  Bruno Miguel de Oliveira Tamer <bmotamer@gmail.com>
     */
    public sealed class Cache
    {

        /*
         * Loads an image
         * 
         * @param  (string) URL - The name of the resource
         * @return (Texture2D)  - The image
         */
        public static Texture2D GetTexture(string URL)
        {
            return Main.self.Content.Load<Texture2D>(URL);
        }

        /*
         * Loads a font
         * 
         * @param  (string) URL - The name of the resource
         * @return (SpriteFont) - The font
         */
        public static SpriteFont GetFont(string URL)
        {
            return Main.self.Content.Load<SpriteFont>(URL);
        }

        /*
         * Loads a music
         * 
         * @param  (string) URL - The name of the resource
         * @return (Song)       - The music
         */
        public static Song GetSong(string URL)
        {
            return Main.self.Content.Load<Song>(URL);
        }

        /*
         * Loads a sound
         * 
         * @param  (string) URL  - The name of the resource
         * @return (SoundEffect) - The sound
         */
        public static SoundEffect GetSoundEffect(string URL)
        {
            return Main.self.Content.Load<SoundEffect>(URL);
        }

        /*
         * Unloads everything already loaded
         */
        public static void Clear()
        {
            Main.self.Content.Unload();
        }

    }

}